<!-- 咨询回复弹窗 -->
<template>
  <div>
    <el-dialog class="replyDiv" title="回复" :visible.sync="visible" @close="closeDialog">
      <el-form :model="ruleForm" ref="ruleForm" label-width=auto>
        <el-form-item label="回复内容:" prop="reply">
          <div class="inputDiv">
            <el-input type="textarea" :rows="5" resize="none" v-model="ruleForm.replayContent"></el-input>
          </div>
        </el-form-item>
        <el-form-item label="附件:" prop="replyfile">
          <el-button type="text">上传</el-button>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="centerReply()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { addConsultReply } from '@/api/api';
export default {
  data() {
    return {
      ruleForm: {
        parentId:"-1",
        replayContent: "",
        replyUserNickname:"test",
        seekAdviceId:""
      },

    }
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    Data:{
      type:Object,
      default:() => ({})
    }
  },
  methods: {
    closeDialog() {
      // 触发一个名为 'update-visible' 的事件，并传递新值  
      this.$emit('update-visible', false);
    },
    async centerReply() {
      this.ruleForm.seekAdviceId = this.Data.id;
      console.log(this.Data.id);
      const res = await addConsultReply(this.ruleForm)
      if (res.data.code == 200) {
        this.$message({
          message: '回复成功',
          type: 'success'
        })
        this.ruleForm.replayContent = ""

        this.closeDialog();
      }
    }
  }

}
</script>
<style scoped>
.el-dialog__wrapper>>>.el-dialog {
  min-width: 200px;
  min-height: 550px;
  border-radius: 0;
}

.replyDiv>>>.el-dialog {
  width: 35%;
}

.inputDiv {
  width: 100%;
  height: 270px;
}

.inputDiv>>>.el-textarea__inner {
  width: 100%;
  height: 270px;
  line-height: 24px;
}
</style>
